package com.img.examine.service.Impl;

import com.img.examine.entity.StudentEntity;
import com.img.examine.mapper.StudentMapper;
import com.img.examine.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;

@Service
public class StudentServiceImpl implements StudentService {
    @Autowired
    StudentMapper studentMapper;
    @Override
    public ArrayList<StudentEntity> getStudent(String key_id, String name, Integer update_time) {
        key_id="%"+key_id.replaceAll(" ","%")+"%";
        name="%"+name.replaceAll(" ","%")+"%";
        if(update_time == 0){
            return studentMapper.getStudentAll(key_id, name);
        }
        String[] update_time2 = EmployeeServiceImpl.getInteger(update_time);
        return studentMapper.getStudent(key_id, name, update_time2[0],update_time2[1]);
    }

    @Override
    public boolean setStudentIcon(String KEY_ID) {
        return studentMapper.setStudentIcon(KEY_ID)>0;
    }
}
